import request from '@/utils/request'

// 创建渠道单
export function createAppChannelOrder(data) {
  return request({
    url: '/pekingfish/app-channel-order/create',
    method: 'post',
    data: data
  })
}

// 更新渠道单
export function updateAppChannelOrder(data) {
  return request({
    url: '/pekingfish/app-channel-order/update',
    method: 'put',
    data: data
  })
}

// 删除渠道单
export function deleteAppChannelOrder(id) {
  return request({
    url: '/pekingfish/app-channel-order/delete?id=' + id,
    method: 'delete'
  })
}

// 获得渠道单
export function getAppChannelOrder(id) {
  return request({
    url: '/pekingfish/app-channel-order/get?id=' + id,
    method: 'get'
  })
}

// 获得渠道单分页
export function getAppChannelOrderPage(query) {
  return request({
    url: '/pekingfish/app-channel-order/page',
    method: 'get',
    params: query
  })
}

export function shipments(id,trackingNumber) {
  const data = {
    id,
    trackingNumber
  }
  return request({
    url: '/pekingfish/app-channel-order/shipments',
    method: 'put',
    data: data
  })
}

// 导出渠道单 Excel
export function exportAppChannelOrderExcel(query) {
  return request({
    url: '/pekingfish/app-channel-order/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 下载用户导入模板
export function importTemplateOrder() {
  return request({
    url: '/pekingfish/app-channel-order/get-import-template',
    method: 'get',
    responseType: 'blob'
  })
}
